#!/usr/bin/ruby

$VERBOSE=true
$DEBUG=true

require 'rubygems'
require 'eventmachine'
require 'evma_httpserver'
require 'pp'

class Handler  < EventMachine::Connection
	include EventMachine::HttpServer

	def process_http_request toto
		resp = EventMachine::DelegatedHttpResponse.new self

		sleep 2 # Simulate a long running request

		resp.status = 200
		resp.content = "Hello World!"
		resp.send_response
	end
end

EventMachine::run do
	EventMachine.epoll
	EventMachine::start_server "0.0.0.0", 8080, Handler
	puts "Listening..."
end

